namespace Playerstats
{
    partial class Stats
    {
    }

    partial class Player
    {
        public Parser.Race getTribe(string output)
        {
            string tribe = new System.Text.RegularExpressions.Regex("<td>(Teutonit|Roomalaiset|Gallialaiset)</td>").Matches(output)[0].Groups[1].Value as string;
            switch (tribe)
            {
                case "Teutonit":
                    {
                        return Parser.Race.Teutons;
                    }
                case "Roomalaiset":
                    {
                        return Parser.Race.Romans;
                    }
                case "Gallialaiset":
                    {
                        return Parser.Race.Gallic;
                    }
                default:
                    break;
            }
            return Parser.Race.Unknown;
        }
        public int? getAllianceNumber(string output)
        {
            System.Text.RegularExpressions.Regex AlRegex = new System.Text.RegularExpressions.Regex("allianz.php?aid=([0-9]+)");
            System.Text.RegularExpressions.MatchCollection matches = AlRegex.Matches(output);
            if (matches.Count > 0)
            {
                return int.Parse(matches[0].Groups[1].Value);
            }
            else
            {
                return null;
            }         
        }
    }
}
